<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function v(n){
            var s="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
            var ret="";
        
            for(var i=0;i<n;i++){
                var index=Math.floor(Math.random()*62);
                ret+=s.charAt(index);
            }   
            return ret;         
       }
       function show(){
                document.getElementById("msg").innerHTML=v(4);
            }
        window.onload=show;
    </script>
</head>
<body>
    <span id="msg"></span>
    <input type="button" value="刷新" onclick="show()">
    
</body>
</html>